// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'babel-polyfill';
import Vue from 'vue';
import App from './App';
import router from './router';
import Vuex from 'vuex';
import { fetch } from '@/fetch/api';

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import store from './store/store.js';
import 'lib-flexible/flexible';
// 公共组件
import * as components from '@/common/index.js';
// import AMap from 'vue-amap';
// Vue.use(AMap);
// AMap.initAMapApiLoader({
//   key: 'ad80fa7014634fa0d1b6f2e1874f30ca ', //刚刚开发者申请哪里的key
//   plugin: ['AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType']
// });

Object.keys(components).forEach(key => {
  Vue.component(key, components[key]);
});
Vue.use(ElementUI);
Vue.use(Vuex);
Vue.prototype.$axios = fetch;
Vue.config.productionTip = false;

Vue.prototype.goback = function() {
  history.back(-1);
};
Vue.prototype.print = function() {
  window.print();
};

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  render: h => h(App)
});
